package co.bugu.code.analysis;

import co.bugu.framework.coder.service.CoderService;
import co.bugu.framework.common.configuration.AutoMapper;
import org.gitlab4j.api.GitLabApi;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication()
@EnableScheduling
//@MapperScan("co.bugu.**.infra.dao")
@AutoMapper
public class CodeApplication {

    public static void main(String[] args) {
        SpringApplication application = new SpringApplication(CodeApplication.class);
        application.setAllowBeanDefinitionOverriding(true);
        ConfigurableApplicationContext context = application.run(args);

    }

    @Bean
    public CoderService coderService() {
        return new CoderService();
    }

    @Bean
    public GitLabApi gitlabApi() {
        String GITLAB_API_URL = "https://gitlab.lbxdrugs.com"; // GitLab API地址
//        String ACCESS_TOKEN = "glpat-RpVcssru2KxRopZsmR_s"; // todo: 替换为你的GitLab Token
//        String ACCESS_TOKEN = "glpat-T2JjcyzfwcYfnjyi8CXK"; // leiyang
        String ACCESS_TOKEN = "glpat-mv5CFDd8Gksu21As8JSs"; // all

        return new GitLabApi(GITLAB_API_URL, ACCESS_TOKEN);
    }
}